package com.iris.live.services.data.repositories;

import com.iris.live.services.data.models.Lsh精品套餐详细Model;
import com.iris.live.services.data.models.Lsh精品套餐详细ModelPK;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * Created by Huangyongping on 2016/9/18.
 */
@Transactional
public interface Lsh精品套餐详细Repository extends JpaRepository<Lsh精品套餐详细Model, Lsh精品套餐详细ModelPK>, JpaSpecificationExecutor<Lsh精品套餐详细Model> {
    @Query("select a from Lsh精品套餐详细Model a where a.套餐编号=?1")
    List<Lsh精品套餐详细Model> findDetailRecordByComboId(int id);

    @Query("select a from Lsh精品套餐详细Model a where a.精品编号=?1")
    List<Lsh精品套餐详细Model> findDetailRecordByQualityId(int qualityId);

    @Modifying
    @Query("delete from Lsh精品套餐详细Model where 套餐编号 = ?1 and 精品编号 = ?2")
    int deleteByPackageIdAndProductId(Integer packageId,Integer ProductId);
}
